package com.aeks.divide;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;

public class GenerateDictionary {
	public void GenHashDic(String filename, HashMap hm, HashMap len)
			throws FileNotFoundException, IOException {
		String s = new String();
		BufferedReader in = new BufferedReader(new FileReader(filename));
		while ((s = in.readLine()) != null) {
			hm.put(s, s.length());//（词，词的长度）
			len.put(s.length(), s);//（词的长度， 词）
		}
		in.close();
	}
	
	public void GenHashDic(String filename, HashMap hm)
	throws FileNotFoundException, IOException {
		String s = new String();
		BufferedReader in = new BufferedReader(new FileReader(filename));
		while ((s = in.readLine()) != null) {
			hm.put(s, s.length());//（停用词，停用词的长度）
		}
		in.close();
	}
}
